//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.common.mybaits;

import com.common.base.Pager;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.ReflectionException;
import org.apache.ibatis.reflection.wrapper.DefaultObjectWrapperFactory;
import org.apache.ibatis.reflection.wrapper.ObjectWrapper;

public class PagerObjectWrapperFactory extends DefaultObjectWrapperFactory {
    public PagerObjectWrapperFactory() {
    }

    public boolean hasWrapperFor(Object object) {
        return object instanceof Pager;
    }

    public ObjectWrapper getWrapperFor(MetaObject metaObject, Object object) {
        if (object instanceof Pager) {
            Pager pager = PagerContextHolder.get();
            PagerContextHolder.remove();
            return new PagerObjectWrapper(pager);
        } else {
            throw new ReflectionException("The DefaultObjectWrapperFactory should never be called to provide an ObjectWrapper.");
        }
    }
}
